/**
 * Description:
 * Class Name:InheritTest
 * Date:2022/1/13 10:06
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第5章_面向对象_上.多态.第5_8.继承与组合;

class Animal{
    private void beat(){
        System.out.println("心脏跳动...");
    }
    public void breathe(){
        beat();
        System.out.println("吸气，吐气，呼吸中...");
    }
}

class Bird extends Animal{
    public void fly(){
        System.out.println("小鸟在天空自由地飞翔");
    }
}

class Wolf extends Animal{
    public void run(){
        System.out.println("小狼在陆地快速地奔跑...");
    }
}

public class InheritTest {
    public static void main(String[] args) {
        var b = new Bird();
        b.breathe();
        b.fly();

        var w = new Wolf();
        w.breathe();
        w.run();
    }
}
